import {
    SET_MONEY
} from '../mutation-types';
import api from '../../api';

// import { errFun } from '../../tools.js'

const state = {
    money: null,
}

const mutations = {
    [SET_MONEY](state, data) {
        state.money = data.money
    }
}

const actions = {
    GET_MONEY: ({ commit, dispatch }) => {
        //  dispatch('CHANGE_LOADING_SHOW').then(
        api.getUserInfo().then(response => {
                commit(SET_MONEY, response.data);
                // debugger;
                // dispatch('HIDDEN_LOADING_SHOW')
            })
            //  )
    }
}

export default {
    state,
    actions,
    mutations
}